<?php
mysql_connect("localhost", "d0031ce7", "toca1974");
mysql_query("USE d0031ce7");
$virusquery = mysql_query("SELECT ReasonExt, COUNT(*) AS count FROM maillog WHERE Reason = 'Virus' GROUP BY ReasonExt ORDER BY count DESC LIMIT 0,10");
$blacklistsquery = mysql_query("SELECT ReasonExt, COUNT(*) AS count FROM maillog WHERE Action = 'Per-User Quarantine' AND Reason = 'Blacklist' GROUP BY ReasonExt ORDER BY count DESC LIMIT 0,10");
$recipientsquery = mysql_query("SELECT Recipient, COUNT(*) AS count FROM maillog WHERE Action = 'Allowed' GROUP BY Recipient ORDER BY count DESC LIMIT 0,10");
$actionquery = mysql_query("SELECT Action , COUNT( * ) AS count FROM maillog GROUP BY Action ORDER BY count DESC LIMIT 0 , 10");
$reasonquery = mysql_query("SELECT Reason , COUNT( * ) AS count FROM maillog GROUP BY Reason ORDER BY count DESC LIMIT 0 , 10");
$domainquery = mysql_query("SELECT Domain , COUNT( * ) AS count FROM maillog GROUP BY Domain ORDER BY count DESC LIMIT 0 , 10");
while($row_virus = mysql_fetch_row($virusquery)) {
      $virus_names_temp[] = $row_virus;
}
while($row_blacklist = mysql_fetch_row($blacklistsquery)) {
      $blacklist_names_temp[] = $row_blacklist;
}
while($row_recipient = mysql_fetch_row($recipientsquery)) {
      $recipient_names_temp[] = $row_recipient;
}
while($row_action = mysql_fetch_row($actionquery)) {
      $action_names_temp[] = $row_action;
}
while($row_reason = mysql_fetch_row($reasonquery)) {
      $reason_names_temp[] = $row_reason;
}
while($row_domain = mysql_fetch_row($domainquery)) {
      $domain_names_temp[] = $row_domain;
}
mysql_close();
foreach ($virus_names_temp as $key => $row_virus) {
         $virus_names[$key] = $row_virus[0];
}
foreach ($virus_names_temp as $key => $row_virus) {
         $virus_values[$key] = $row_virus[1];
}
foreach ($blacklist_names_temp as $key => $row_blacklist) {
         $blacklist_names[$key] = $row_blacklist[0];
}
foreach ($blacklist_names_temp as $key => $row_blacklist) {
         $blacklist_values[$key] = $row_blacklist[1];
}
foreach ($recipient_names_temp as $key => $row_recipient) {
         $recipient_names[$key] = $row_recipient[0];
}
foreach ($recipient_names_temp as $key => $row_recipient) {
         $recipient_values[$key] = $row_recipient[1];
}
foreach ($action_names_temp as $key => $row_action) {
         $action_names[$key] = $row_action[0];
}
foreach ($action_names_temp as $key => $row_action) {
         $action_values[$key] = $row_action[1];
}
foreach ($reason_names_temp as $key => $row_reason) {
         $reason_names[$key] = $row_reason[0];
}
foreach ($reason_names_temp as $key => $row_reason) {
         $reason_values[$key] = $row_reason[1];
}
foreach ($domain_names_temp as $key => $row_domain) {
         $domain_names[$key] = $row_domain[0];
}
foreach ($domain_names_temp as $key => $row_domain) {
         $domain_values[$key] = $row_domain[1];
}
session_start();
$_SESSION['virus_names'] = $virus_names;
$_SESSION['virus_values'] = $virus_values;
$_SESSION['blacklist_names'] = $blacklist_names;
$_SESSION['blacklist_values'] = $blacklist_values;
$_SESSION['recipient_names'] = $recipient_names;
$_SESSION['recipient_values'] = $recipient_values;
$_SESSION['action_names'] = $action_names;
$_SESSION['action_values'] = $action_values;
$_SESSION['reason_names'] = $reason_names;
$_SESSION['reason_values'] = $reason_values;
$_SESSION['domain_names'] = $domain_names;
$_SESSION['domain_values'] = $domain_values;
echo "<html>\n";
echo "<head>\n";
echo "<title>Barracuda Spamfirewall Statistik &Uuml;bersicht</title>\n";
echo "</head>\n";
echo "<body>\n";
echo "<b>Globale Statistik - &Uuml;bersicht</b>\n";
echo "<br><br>\n";
echo "<table border=\"1\">\n";
echo "<tr>\n";
echo "<td><b>Top 10 Virus &Uuml;bersicht</b></td>\n";
echo "<td><b>Top DNS-Blacklists &Uuml;bersicht</b></td>\n";
echo "<td><b>Top 10 Empf&auml;nger &Uuml;bersicht</b></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td><img src=\"topvirus-diagramm-global.php\" border=\"0\"></td>\n";
echo "<td><img src=\"topblacklists-diagramm-global.php\" border=\"0\"></td>\n";
echo "<td><img src=\"toprecipients-diagramm-global.php\" border=\"0\"></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td><b>Top Action &Uuml;bersicht</b></td>\n";
echo "<td><b>Top Reason &Uuml;bersicht</b></td>\n";
echo "<td><b>Top Domain &Uuml;bersicht</b></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td><img src=\"topaction-diagramm-global.php\" border=\"0\"></td>\n";
echo "<td><img src=\"topreason-diagramm-global.php\" border=\"0\"></td>\n";
echo "<td><img src=\"topdomain-diagramm-global.php\" border=\"0\"></td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "<br>\n";
echo "<a href=\"per-domain.php\" target=\"_blank\"><b>Pro Domain Statistik - &Uuml;bersicht</b></a>\n";
echo "</body>\n";
echo "</html>\n";
?>
